package com.mnyc.research.service.impl;

import java.util.List;

import com.mnyc.common.utils.DateUtils;
import com.mnyc.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mnyc.research.mapper.JySchoolResearchMapper;
import com.mnyc.research.domain.JySchoolResearch;
import com.mnyc.research.service.IJySchoolResearchService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 校本教研Service业务层处理
 *
 * @author ruoyi
 * @date 2025-08-06
 */
@Service
public class JySchoolResearchServiceImpl implements IJySchoolResearchService {
    @Autowired
    private JySchoolResearchMapper jySchoolResearchMapper;

    /**
     * 查询 校本教研
     *
     * @param id 校本教研主键
     * @return 校本教研
     */
    @Override
    public JySchoolResearch selectJySchoolResearchById(Long id) {
        return jySchoolResearchMapper.selectJySchoolResearchById(id);
    }

    /**
     * 查询 校本教研列表
     *
     * @param jySchoolResearch 校本教研
     * @return 校本教研
     */
    @Override
    public List<JySchoolResearch> selectJySchoolResearchList(JySchoolResearch jySchoolResearch) {
        return jySchoolResearchMapper.selectJySchoolResearchList(jySchoolResearch);
    }

    /**
     * 新增 校本教研
     *
     * @param jySchoolResearch 校本教研
     * @return 结果
     */

    @Transactional
    @Override
    public int insertJySchoolResearch(JySchoolResearch jySchoolResearch) {
        jySchoolResearch.setCreateBy(SecurityUtils.getUsername());
        jySchoolResearch.setCreateTime(DateUtils.getNowDate());
        return jySchoolResearchMapper.insertJySchoolResearch(jySchoolResearch);
    }

    /**
     * 修改 校本教研
     *
     * @param jySchoolResearch 校本教研
     * @return 结果
     */

    @Transactional
    @Override
    public int updateJySchoolResearch(JySchoolResearch jySchoolResearch) {
        jySchoolResearch.setUpdateBy(SecurityUtils.getUsername());
        jySchoolResearch.setUpdateTime(DateUtils.getNowDate());
        return jySchoolResearchMapper.updateJySchoolResearch(jySchoolResearch);
    }

    /**
     * 批量删除 校本教研
     *
     * @param ids 需要删除的 校本教研主键
     * @return 结果
     */
    @Transactional
    @Override
    public int deleteJySchoolResearchByIds(Long[] ids) {
        return jySchoolResearchMapper.deleteJySchoolResearchByIds(ids);
    }

    /**
     * 删除 校本教研信息
     *
     * @param id 校本教研主键
     * @return 结果
     */

    @Transactional
    @Override
    public int deleteJySchoolResearchById(Long id) {
        return jySchoolResearchMapper.deleteJySchoolResearchById(id);
    }
}
